package com.kefu.exam.vo;

import javax.validation.constraints.Size;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import com.kefu.common.context.KefuContext;
import com.kefu.common.vo.AbstractUpdateVo;
import com.kefu.exam.model.ExamSubjectType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

/**
 * @author xy
 * @date 2022/02/28
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@ApiModel(description = "考题分类表")
public class ExamSubjectTypeUpdateVo extends AbstractUpdateVo<ExamSubjectType,String> {

    @NotEmpty
    @ApiModelProperty(value = "主键")
    private String typeId;
    @Size(max = 200)
    @ApiModelProperty(value = "分类名")
    private String typeName;
    @Size(max = 200)
    @ApiModelProperty(value = "创建人姓名")
    private String createName;
    @Size(max = 200)
    @ApiModelProperty(value = "更新人姓名")
    private String updateName;
    @ApiModelProperty(value = "分类排序")
    private Integer typeSort;
    @Size(max = 500)
    @ApiModelProperty(value = "分类描述")
    private String typeComments;

    @Override
    public ExamSubjectType convert() {
        ExamSubjectType info = new ExamSubjectType();
        info.setTypeName(typeName);
        info.setCreateName(createName);
        info.setUpdateName(updateName);
        info.setTypeSort(typeSort);
        info.setTypeComments(typeComments);
        KefuContext context = KefuContext.getKefuContext();
        info.setTypeId(typeId);
        info.setUpdateUser(context.getUserId());
        info.setUpdateTime(context.getNow());
        return info;
	}
}